// MapMakerDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "NodeX.H"
#include "NycMap.h"

#define SELECT_RADIUS   10
#define SELECTED_COLOR  RGB(255,0,0)
#define DEFAULT_COLOR   RGB(0,0,0)

// CMapMakerDlg dialog
class CMapMakerDlg : public CDialog
{
public:
	CMapMakerDlg(CWnd* pParent = NULL);
	enum { IDD = IDD_MAPMAKER_DIALOG };

protected:

    enum { MODE_NONE, MODE_CON_NORTH, MODE_CON_EAST, 
        MODE_CON_SOUTH, MODE_CON_WEST };

	HICON m_hIcon;

    void NewNode(CPoint& pt);
    void UpdateInfo();
    void SetCurNode(CNode* n);
    CPoint Gridalize(const CPoint& pt);
    void ConnectNode(CNode* n);
    void WriteNodes(CStdioFile& file);
    void WritePaths(CStdioFile& file);

    // Member variables
    CNode* m_cnode;
    CNodePtrVec m_vecNodes;
    CNycMap m_dlgMap;
    //CPathGen m_pathGen;
    int m_nodeCount;
    int m_mode;

    // Dialog items
    CListBox m_dlgList;
    CEdit m_dlgEdit;
    CEdit m_dlgNodeName;
    CEdit m_dlgNodeNorth;
    CEdit m_dlgNodeEast;
    CEdit m_dlgNodeSouth;
    CEdit m_dlgNodeWest;
    CButton m_dlgAddMode;
    CEdit m_dlgDesc;
    CButton m_dlgOutletCheck;
    CButton m_dlgInletCheck;

    // Generated message map functions
    virtual void DoDataExchange(CDataExchange* pDX);
	virtual BOOL OnInitDialog();
    void ToBmpCoords(CPoint& pt);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnClicked_NycMap();
    afx_msg void OnMenu_ClearMap();
    afx_msg void OnClicked_North();
    afx_msg void OnClicked_East();
    afx_msg void OnClicked_South();
    afx_msg void OnClicked_West();
    afx_msg void OnFileSave();
    afx_msg void OnClicked_DeleteNode();
    afx_msg void OnClicked_Inlet();
    afx_msg void OnClicked_Outlet();
    afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
    afx_msg void OnClicked_NudgeUp();
    afx_msg void OnClicked_NudgeRight();
    afx_msg void OnClicked_NudgeDown();
    afx_msg void OnCicked_NudgeLeft();
    afx_msg void OnFileOpen();
    afx_msg void OnDestroy();
	DECLARE_MESSAGE_MAP()
};

